{
  "apiVersion": "networking.k8s.io/v1",
  "kind": "NetworkPolicy",
  "metadata": {
    "name": "guestbook-redis"
  },
  "spec": {
    "podSelector": {
      "matchLabels": {
        "k8s-app.guestbook": "redis"
      }
    },
    "ingress": [
      {
        "from": [
          {
            "podSelector": {
              "matchLabels": {
                "k8s-app.guestbook": "web"
              }
            }
          },
          {
            "podSelector": {
              "matchLabels": {
                "k8s-app.guestbook": "redis"
              }
            }
          }
        ],
        "ports": [
          {
            "protocol": "TCP",
            "port": 6379
          }
        ]
      }
    ]
  }
}
